<template>
  <div class="home">
    <div class="good">
      <GoodList @addChange="add"></GoodList>
    </div>
    <div class="navBar">
      <nav>
        <router-link to="/home" class="active">购物车</router-link>
        <router-link to="/user">我的</router-link>
      </nav>
    </div>
  </div>
</template>

<script>
import bus from '../eventBus.js'

import GoodList from '@/components/goodList.vue'

export default {
  name: 'HomeView',
  data() {
    return {}
  },
  methods: {
    add(val) {
      bus.$emit('share', val)
    }
  },
  components: {
    GoodList
  }
}
</script>

<style scoped>
.home {
  background-color: silver;
}
.good {
  padding: 5px 5px 24px 5px;
}
.navBar {
  width: 100%;
  position: fixed;
  bottom: 0;
}
nav {
  margin: 0 5px;
  background-color: #fff;
  border-top: 1px solid #000;
  display: flex;
  flex-direction: row;
}
nav a {
  width: 100%;
  text-align: center;
  color: #f18741;
  text-decoration: none;
}
.active {
  background-color: #fef5ef;
}
</style>
